<?php 

if( $total_links == 0 ) {
      echo "No Links Have Been Created In This Category For This Site";
      return;
   }

   echo "
		<table border=0 cellspacing=0 cellpadding=4 width=100% class='cms-data-table'>
			<tr>
				<th align=right width='25'><input type='checkbox' value='' id='checkAll' name='checkAll' /></th>
				<th align='left'>Article Title</th>
				<th>Options</th>
			</tr>
	";

   for($i = 0, $j = $start; $i < count($links); $i++, $j++) {
      $title = $links[$i]->getData('LinkName');
      $id = $links[$i]->getData('id');
	  $published = $links[$i]->getData('Published');
	  
	  $pub_link_class = $published == "true" ? 'cms-publish-link' : 'cms-unpublish-link';
	  $pub_link_title = $published == "true" ? 'Published (Click To Unpublish)' : 'Unpublised (Click To Publish Now)';
	  $short_title = (strlen($title) > 55) ? (substr($title, 0, 55) . "...") : $title;
	  
      echo "
			<tr id='article-row-$id'>
				<td align=right width='25'><input type='checkbox' value='$id' /></td>
				<td>" . ($j + 1) . ". <a id='$id' class='edit-link' href='" . $this->url(array('action' => 'edit', 'id' => $id)) . "' title='$title'>$short_title</a></td>
				<td align=center width='30%'>
					<a id='$id' class='edit-link' href='" . $this->url(array('action' => 'edit', 'id' => $id)) . "'><img src='images/icons/link_edit.png' alt='' align='absmiddle' border=0 /> Edit</a>
					<a id='$id' class='delete-link' href='" . $this->url(array('action' => 'delete', 'id' => $id)) . "'><img src='images/icons/link_delete.png' alt='' align='absmiddle' border=0 /> Delete</a>
					<a id='$id' class='$pub_link_class' href='" . $this->url(array('action' => 'publish_link', 'id' => $id)) . "' title='$pub_link_title'></a>
				</td>
			</tr>
         ";
   }

   echo "
		</table>
	";

	// echo out the values of the total article count as hidden field in order to be accessed
	// by the javascript processor
	// we'll do this if only the first page is being loaded
   if( !isset($_POST['no-total']) ) {
	   echo "
			<input type='hidden' id='link-total' value='$total_links' />
	   ";
   }
?>